package com.yinhai.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.yinhai.activity.R;

/**
 *即时聊天点击加号显示列表
 * @author Administrator
 *
 */
public class PlusAdpter extends BaseAdapter {
	private LayoutInflater mInflater;
	private int[] funcImages = {
			R.drawable.chat_abu,
			R.drawable.chat_cameral,
			R.drawable.chat_position
	};
	private String[] funcList = {"图片","拍照","位置"};
	public PlusAdpter(Context context) {
		mInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		int position=funcList.length;
		return position;
	}
	@Override
	public Object getItem(int position) {
		return position;
	}
	@Override
	public long getItemId(int position) {
	//TODO Auto-generated method stub
		return position;
	} 

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = null;
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.plus_list_item, parent,
					false);
			holder = new ViewHolder();
			holder.plus_img = (ImageView) convertView.findViewById(R.id.PlusItemImage);
			holder.plus_txt = (TextView) convertView.findViewById(R.id.PlusItemText);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.plus_img.setImageResource(funcImages[position]);
		holder.plus_txt.setText(funcList[position]);
		convertView.setTag(holder);
		return convertView;
	}

	public final class ViewHolder {
		public ImageView plus_img;
		public TextView plus_txt;
	}
}
